package test
{
	import com.adobe.net.URI;
	
	import flash.utils.ByteArray;
	
	import org.net.data.DataPackager;
	import org.net.httpclient.HttpRequest;
	import org.net.httpclient.HttpRequestObject;
	import org.net.httpclient.HttpSocket;
	import org.net.httpclient.http.Post;

	public class TestCase
	{		
		[Before]
		public function setUp():void
		{
		}
		
		[After]
		public function tearDown():void
		{
		}
		
		[BeforeClass]
		public static function setUpBeforeClass():void
		{
		}
		
		[AfterClass]
		public static function tearDownAfterClass():void
		{
		}
		
		
		public function testA():void
		{
			trace("asdf");
		}
		
		/**
		 * Test post using rails resource.
		 */
		[Test]
		public function testPost():void {
			//http://rrworldhd.renren.com/gamedata.py
			var uri:URI = new URI("http://sgtest.renren.com:8084/gamedata.py?appId=110215&t=1338802726491");
			var reqObj:HttpRequestObject = new HttpRequestObject("getUserInfo",[]);
			
			var headData:ByteArray=new ByteArray();
			headData.writeInt(0xA1B2);
			headData.writeByte(0x10);
			headData.writeByte(0xC);
			headData.writeUTF("224049118#110215#l63ocwAM0H");
			
			var contentData:ByteArray=new ByteArray();
			var pack:DataPackager =new DataPackager(contentData);
			
			pack.writeUTFString(reqObj.funcName);
			pack.writeArray(reqObj.vars);
			
			var request:HttpRequest = new Post(headData, contentData);
			var _socket:HttpSocket = new HttpSocket();
			
			_socket.request(uri, request);

		}
	}
}